/*This file is part of AENIMA. AENIMA is a module of BCI++ framework for the implementation of brain computerinterface systems. 
AEnima is intended for use with BCI++ only.

BCI++ is a project of the Sensibilab of the Politecnico di Milano. 

AENIMA is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation, either version 3 of 
the License, or (at your option) any later version.

AENIMA is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU General Public License
and the GNU Lesser General Public License along with AENIMA.  
If not, see <http://www.gnu.org/licenses/>.*/

/*!
	\file	BCIMessage.h
	 This struct is the message that the Hardware Interface Module and AEnima use to communicate on TCP/IP socket. 

	\author	Sensibilab EMail: info.sensibilab@polimi.it

	\date	2007-09-06 creation \n
		2009-01-27 last modification

	\b COPYRIGHT: 
		This program is property of Sensibilab - Campus Ponit - Lecco
*/
#ifndef BCIMESSAGE_INC
#define BCIMESSAGE_INC

//Instrument control
const int	START_ACQ				=	101;
const int	STOP_ACQ				=	102;
const int	CONNECTION_COMPLETED	=	103;

//Triggers event
const int	GRAPH_TRIG				=	201;

//Messages from algorithm to AEnima
const int	CLASSIFICATION			=	301;
const int	FEEDBACK				=	302;
const int	SET_PARAMS				=	303;

//Messagese from AEnima to algorithm
const int	RESET_ALGORITHM			=	401;
const int	REQUEST_PARAMS			=	402;

//Generic messages
const int	BCI_OK					=	501;
const int	BCI_ERROR				=	502;

/*!\struct BCIMessage
\param kind Message type:\nSTART_ACQ, STOP_ACQ, CONNECTION_COMPLETED, GRAPH_TRIG, CLASSIFICATION, FEEDBACK, SET_PARAMS, RESET_ALGORITHM, REQUEST_PARAMS, BCI_OK, BCI_ERROR.\n
For detail see AEnima overview.doc.
\param value In some case it can be usefull to send and receive a value during the communication.
\param Buffer The buffer can carry up to 16 int value.
\param Check This value is used to control if the sent/received message is correct.*/
typedef struct BCIMessage
{
	int Kind;//Used to define which message you are sending
	int Value;//Used for single value messages
	int Buffer[16];//Storage space for DATA
	int Check; //MS Kind+Value;
}BCIMessage;

/*!\fn BCIMessage ComposeMessage(int Kind, int Value, int *pBuffer,int BuffSize)
This function can be used to compose a BCIMessage*/
BCIMessage ComposeMessage(int Kind, int Value = 0, int *pBuffer= 0,int BuffSize = 0);

bool CheckMessage(BCIMessage *pMess);


#endif